#define _CRT_SECURE_NO_WARNINGS	

#include<stdio.h>

int main()
{
    int start, gap;
    scanf("%d%d", &start, &gap);
    int sum = start / 100 * 60 + start % 100 + gap;
    while (sum >= 24 * 60)
        sum -= 24 * 60;
    printf("%d%02d", sum / 60, sum - sum / 60 * 60);
    return 0;
}